package com.example.myapplication;

import static android.content.ContentValues.TAG;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity2 extends AppCompatActivity {
    private TextView scoring1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main2);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            scoring1=findViewById(R.id.s1);
            return insets;
        });

    }
    public void click(View btn){
        Log.i(TAG,"click:11111");
        String s=(String)scoring1.getText();
        int ints=Integer.parseInt(s);
        if(btn.getId()==R.id.btn3){
            ints+=3;
        }
        else if(btn.getId()==R.id.btn2){
            ints+=2;
        }
        else if(btn.getId()==R.id.btn1){
            ints+=1;
        }
        else{
            ints=0;
        }
        scoring1.setText(String.valueOf(ints));
    }
}